/*
 * Ccharacter.cpp
 *
 *  Created on: Apr 19, 2012
 *      Author: builder
 */

#include "Ccharacter.h"


// initialize stuff
void Ccharacter::initialize() {
	max_health = 100;
	health = 100;
	energy = MAX_ENERGY;
	att = 10;
	def = 10;
	spd = 10;
	money = 0;
	status = "No status";
}


// walk - lose health. Random generator to get stuff
void Ccharacter::walk () {
	if (energy >= E_WALK) {
		energy = energy - E_WALK;
		uint8_t random = rand() % 90;

			// defense
		if ( random <= 5 ) {
			cout << "You find a magical potion of snails near some pebbles. +1 defense!" << endl;
			def+=1;
		} else if ( random > 5 && random <= 8 ) {
			cout << "A dead armadillo! Great for stew. +2 defense!" << endl;
			def+=2;
		} else if ( random > 8 && random <= 10 ) {
			cout << "You find turtle mana sitting in some tall grass. +3 defense!" << endl;
			def+=3;
		} else if ( random == 11 ) {
			cout << "A swallow drops a godly potion of hippopotamus skin in your hands. +5 defense!" << endl;
			def+=5;

			// attack
		} else if ( random > 11 && random <= 17) {
			cout << "You find a hive. Bee stingers for dinner. +1 attack!" << endl;
			att+=1;
		} else if ( random > 17 && random <= 21 ) {
			cout << "A bottle filled with raccoon's sweat lies on a nearby rock. +2 attack!" << endl;
			att+=2;
		} else if ( random > 21 && random <= 23 ) {
			cout << "You see a flask of ancient coyote stew on a branch. +3 attack!" << endl;
			att+=3;
		} else if ( random == 24 ) {
			cout << "A vibrant ray engulfs you. Mystical powers bestows you more power. +5 attack!" << endl;
			att+=5;

			// speed
		} else if ( random > 24 && random <= 30) {
			cout << "A butterfly wants to play! You chase it round and round...+1 speed" << endl;
			spd+=1;
		} else if ( random > 30 && random <= 33 ) {
			cout << "Jackpot! A pile of horse manure lies on the side of the road. +2 speed" << endl;
			spd+=2;
		} else if ( random > 33 && random <= 34 ) {
			cout << "A mysteriously blue canteen lies on a boulder. You're thirsty and drink. You feel lighter. +3 speed!" << endl;
			spd+=3;
		} else if ( random == 35 ) {
			cout << "The spirit of the cheetah is with you. +5 speed" << endl;
			spd+=5;

			// health
		} else if ( random > 35 && random <= 38) {
			cout << "A strong gust of wind lifts your spirits. +5 max health" << endl;
			max_health+=5;
		} else if ( random > 38 && random <= 40 ) {
			cout << "You find a stream nearby and go fishing. Good tuna here. +10 max health" << endl;
			max_health+=10;
		} else if ( random > 40 && random <= 41 ) {
			cout << "You find a recently deceased Snorlax on the side roads. Healthy meat! +15 max health" << endl;
			max_health+=15;
		} else if ( random == 42 ) {
			cout << "You're tired and fall asleep........a while later, you wake up and find yourself..taller?? +20 max health" << endl;
			max_health+=20;
		} else if ( random > 42 && random <= 45  ) {
			cout << "You take a quick power nap. Healthy as ever!" << endl;
			health = max_health;
		} else {
			cout << endl;
		}
		cout << "You walk and walk and eventually get fatigued. -10 energy" << endl;

	} else {
		cout << "No energy, nublet! Go rest!" << endl;
	}
}

int Ccharacter::rest ( int day ) {
	cout << "ZZZZZZZZzzzzzzzzzzzzzzzzzz......" << endl;
	cout << "zzz..zzz...zzzz...... You feel sooooo refreshed!" << endl;
	health=max_health;
	energy=MAX_ENERGY;
	day++;
	return day;
}

void Ccharacter::train () {
	if (energy >= E_TRAIN) {
		energy = energy - E_TRAIN;
		att+=2;
		def+=2;
		cout << "You train real hard. Do those weights! +2 att, +2 def" << endl;
	} else {
		cout << "You look like a n00b lifting pencils. You feel tired." << endl;
	}
}

void Ccharacter::run () {
	if (energy >= E_RUN) {
		energy = energy - E_RUN;
		spd+=4;
		cout << "You run like the wind! +4 speed" << endl;
	} else {
		cout << "Hahaha....people boo you as a turtle easily surpasses you. Your legs give out." << endl;
	}
}

void Ccharacter::meditate () {
	if (energy >= E_MEDITATE) {
		energy = energy - E_MEDITATE;
		max_health = max_health + 10;
		cout << "You find inner peace and build up your stamina. Max health +10" << endl;
	} else {
		cout << "You fall asleep in an awkward position while meditating." << endl;
		cout << "You feel sore..." << endl;
	}
}


Ccharacter::~Ccharacter() {
	// TODO Auto-generated destructor stub
}
